<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    

<head><meta name="generator" content="Hexo 3.8.0">
    <meta charset="utf-8">
    <meta name="keywords" content="ofo仿写记录, 炫杉">
    <meta name="description" content="ofo不解释，教程同样来自小波。

小知识点
解包 .car 文件：https://github.com/insidegui/AssetCatalogTinkerer仿写必备咯
很多时候Constrain不好加，可以先拖到合适的地方。比如拖">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>ofo仿写记录 | 炫杉</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/css/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery-2.2.0.min.js"></script>
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css">
<link rel="stylesheet" href="/css/prism-line-numbers.css" type="text/css"></head>

</head>

<body>

<header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="container">
            <div class="nav-wrapper">
                <div class="brand-logo">
                    <a href="/" class="waves-effect waves-light">
                        
                        <img src="/medias/logo.png" class="logo-img hide-on-small-only">
                        
                        <span class="logo-span">炫杉</span>
                    </a>
                </div>
                <a href="#" data-activates="mobile-nav" class="button-collapse"><i class="fa fa-navicon"></i></a>
<ul class="right">
    
    <li class="hide-on-med-and-down">
        <a href="/" class="waves-effect waves-light">
            
            <i class="fa fa-home"></i>
            
            <span>Index</span>
        </a>
    </li>
    
    <li class="hide-on-med-and-down">
        <a href="/tags" class="waves-effect waves-light">
            
            <i class="fa fa-tags"></i>
            
            <span>Tags</span>
        </a>
    </li>
    
    <li class="hide-on-med-and-down">
        <a href="/categories" class="waves-effect waves-light">
            
            <i class="fa fa-bookmark"></i>
            
            <span>Categories</span>
        </a>
    </li>
    
    <li class="hide-on-med-and-down">
        <a href="/archives" class="waves-effect waves-light">
            
            <i class="fa fa-archive"></i>
            
            <span>Archives</span>
        </a>
    </li>
    
    <li class="hide-on-med-and-down">
        <a href="/about" class="waves-effect waves-light">
            
            <i class="fa fa-user-circle-o"></i>
            
            <span>About</span>
        </a>
    </li>
    
    <li class="hide-on-med-and-down">
        <a href="https://oo1.win" class="waves-effect waves-light">
            
            <i class="fa fa-star"></i>
            
            <span>Bookmark</span>
        </a>
    </li>
    
    <li>
        <a id="toggleSearch" class="waves-effect waves-light">
            <i id="searchIcon" class="mdi-action-search"></i>
        </a>
    </li>

</ul>

<div class="side-nav" id="mobile-nav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">炫杉</div>
        <div class="logo-desc">
            
            提着鸟笼的老头站在一旁拍我肩膀 我猜他想的应该和我一样
            
        </div>
    </div>

    <ul class="menu-list mobile-menu-list">
        
        <li>
            <a href="/" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-home"></i>
                
                Index
            </a>
        </li>
        
        <li>
            <a href="/tags" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-tags"></i>
                
                Tags
            </a>
        </li>
        
        <li>
            <a href="/categories" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-bookmark"></i>
                
                Categories
            </a>
        </li>
        
        <li>
            <a href="/archives" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-archive"></i>
                
                Archives
            </a>
        </li>
        
        <li>
            <a href="/about" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-user-circle-o"></i>
                
                About
            </a>
        </li>
        
        <li>
            <a href="https://oo1.win" class="waves-effect waves-light">
                
                <i class="fa fa-fw fa-star"></i>
                
                Bookmark
            </a>
        </li>
        
        
    </ul>

    <div class="social-link"><a href="https://github.com/ixsim" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
    <i class="fa fa-github"></i>
</a>

<a href="mailto:chenjiayin1990@163.com" class="tooltipped" target="_blank" data-tooltip="邮件:chinalixs@qq.com" data-position="top" data-delay="50">
    <i class="fa fa-envelope-open"></i>
</a>

<a href="http://wpa.qq.com/msgrd?v=3&uin=6956820&site=qq&menu=yes" class="tooltipped" data-tooltip="QQ: 6956820" data-position="top" data-delay="50">
    <i class="fa fa-qq"></i>
</a>
</div>
</div>

            </div>
        </div>

        
    </nav>
</header>



<div class="bg-cover post-cover" style="background-image: url('/medias/featureimages/9.jpg')">
    <div class="container">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <div class="description center-align post-title">
                        ofo仿写记录
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1,
    #articleContent h2,
    #articleContent h3,
    #articleContent h4,
    #articleContent h5,
    #articleContent h6 {
        padding-top: 76px;
        margin-top: -76px;
    }

    #articleContent h1 {
        line-height: 3.5rem;
    }

    #articleContent h2 {
        line-height: 3.2rem;
    }

    #articleContent h3 {
        line-height: 2.8rem;
    }

    #articleContent h4 {
        line-height: 2.5rem;
    }

    #articleContent h5 {
        line-height: 2.2rem;
    }

    #articleContent h6 {
        line-height: 1.9rem;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }
</style>
<div class="row">
    <div class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            
            <div class="article-tag">
                
                <a href="/tags/Swift/" target="_blank">
                    <span class="chip bg-color">Swift</span>
                </a>
                
            </div>
            
            <div class="post-info">
                
                <span class="post-cate">
                    <i class="fa fa-bookmark fa-fw icon-category"></i>
                    
                    <a href="/categories/iOS/" class="post-category" target="_blank">
                        iOS
                    </a>
                    
                </span>
                

                <span class="post-date">
                    <i class="fa fa-clock-o fa-fw"></i>2018-05-16
                </span>
            </div>
        </div>
        <hr>
        <div class="card-content article-card-content">
            <div id="articleContent">
                <p>ofo不解释，教程同样来自小波。</p>
<a id="more"></a>
<h1 id="小知识点"><a href="#小知识点" class="headerlink" title="小知识点"></a>小知识点</h1><ul>
<li>解包 .car 文件：<br><a href="https://github.com/insidegui/AssetCatalogTinkerer" target="_blank" rel="noopener">https://github.com/insidegui/AssetCatalogTinkerer</a><br>仿写必备咯</li>
<li>很多时候Constrain不好加，可以先拖到合适的地方。比如拖得贴近边框</li>
<li>ImageView没法调宽度（Table Session里）可以先放一个Container View</li>
<li>按比例添加Constarin：在控件总览栏右键从一个容器拖到上一层容器上，选的等宽，右侧属性改为0.25. 就是占上一层容器的1/4</li>
<li>把一个view放到顶层：<code>view.bringSubview(toFront: ___)</code></li>
<li>在模拟器按住option可以双指</li>
<li>dump()有点像print但是可以输出属性</li>
<li>加注释技巧:<code>// MARK: -这样可以在查看函数时快速定位</code></li>
</ul>
<h1 id="加载网页"><a href="#加载网页" class="headerlink" title="加载网页"></a>加载网页</h1><h2 id="WebView"><a href="#WebView" class="headerlink" title="WebView"></a>WebView</h2><p>网页自适应选项在这：<br><img src="http://p66eruxmw.bkt.clouddn.com/15264706713494.jpg" alt=""></p>
<p>写法：</p>
<pre class="line-numbers language-Swift"><code class="language-Swift">let url = URL(string: "http://m.ofo.so/active.html")!

let requset = URLRequest(url: url)

webView.loadRequest(requset)
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h2 id="WebKit"><a href="#WebKit" class="headerlink" title="WebKit"></a>WebKit</h2><pre class="line-numbers language-Swift"><code class="language-Swift">import WebKit

var webView: WKWebView!
webView = WKWebView(frame: self.view.frame) //调大小
view.addSubview(webView) //加到视图里

let url = URL(string: "http://m.ofo.so/active.html")!
let requset = URLRequest(url: url)

webView.load(requset)
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h1 id="侧边栏"><a href="#侧边栏" class="headerlink" title="侧边栏"></a>侧边栏</h1><h2 id="第三方库-初探"><a href="#第三方库-初探" class="headerlink" title="第三方库 初探"></a>第三方库 初探</h2><p><a href="https://cocoapods.org" target="_blank" rel="noopener">https://cocoapods.org</a></p>
<p>装 cocoapods:</p>
<pre class="line-numbers language-shell"><code class="language-shell">sudo gem install cocoapods
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<h2 id="安装SWRevealViewController"><a href="#安装SWRevealViewController" class="headerlink" title="安装SWRevealViewController"></a>安装SWRevealViewController</h2><p>在podfile加入<br><code>pod &#39;SWRevealViewController&#39;,2.3</code><br>Terminal运行：<br><code>pod install</code></p>
<ul>
<li>由于SWRevealViewController是OC写的，要做一个桥接：<br>新建一个OC文件，自动生成一个桥接.h文件。删除OC文件即可。</li>
</ul>
<p>在桥接.h文件里加入<br><code># import &quot;路径/SWRevealViewController.h&quot;</code><br>在要使用的场景里加入<br><code>import SWRevealViewController</code></p>
<h2 id="使用-SWRevealViewController"><a href="#使用-SWRevealViewController" class="headerlink" title="使用 SWRevealViewController"></a>使用 SWRevealViewController</h2><ol>
<li>拖一个ViewController，类选择SWRevealViewController</li>
<li>程序入口改成这个VC</li>
<li>从这个ViewController右键拖到1场景和2场景，都选择SW-Set</li>
<li>两个场景的路径设置Segue的id，前面的叫sw_front，后面（划出来）的叫sw_rear</li>
<li>写代码</li>
</ol>
<pre class="line-numbers language-swift"><code class="language-swift"><span class="token keyword">if</span> <span class="token keyword">let</span> revealVC <span class="token operator">=</span> <span class="token function">revealViewController</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>

    revealVC<span class="token punctuation">.</span>rearViewRevealWidth <span class="token operator">=</span> <span class="token number">300</span> <span class="token comment" spellcheck="true">//设宽度</span>

    navigationItem<span class="token punctuation">.</span>leftBarButtonItem<span class="token operator">?</span><span class="token punctuation">.</span>target <span class="token operator">=</span> revealVC
    navigationItem<span class="token punctuation">.</span>leftBarButtonItem<span class="token operator">?</span><span class="token punctuation">.</span>action <span class="token operator">=</span> #<span class="token function">selector</span><span class="token punctuation">(</span><span class="token builtin">SWRevealViewController</span><span class="token punctuation">.</span><span class="token function">revealToggle</span><span class="token punctuation">(</span><span class="token number">_</span><span class="token punctuation">:</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//这句是OC语法   `#selecot`是OC的一个方法</span>
    view<span class="token punctuation">.</span><span class="token function">addGestureRecognizer</span><span class="token punctuation">(</span>revealVC<span class="token punctuation">.</span><span class="token function">panGestureRecognizer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>在滑动菜单里点击按钮转场：<br>右键拖到场景里，选 r-v-c push 即可<br>再放上刚刚的代码（记得在场景里Embed in个导航）</p>
<pre class="line-numbers language-swift"><code class="language-swift"><span class="token keyword">if</span> <span class="token keyword">let</span> revealVC <span class="token operator">=</span> <span class="token function">revealViewController</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>

    revealVC<span class="token punctuation">.</span>rearViewRevealWidth <span class="token operator">=</span> <span class="token number">300</span> <span class="token comment" spellcheck="true">//设宽度</span>

    navigationItem<span class="token punctuation">.</span>leftBarButtonItem<span class="token operator">?</span><span class="token punctuation">.</span>target <span class="token operator">=</span> revealVC
    navigationItem<span class="token punctuation">.</span>leftBarButtonItem<span class="token operator">?</span><span class="token punctuation">.</span>action <span class="token operator">=</span> #<span class="token function">selector</span><span class="token punctuation">(</span><span class="token builtin">SWRevealViewController</span><span class="token punctuation">.</span><span class="token function">revealToggle</span><span class="token punctuation">(</span><span class="token number">_</span><span class="token punctuation">:</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//这句是OC语法   `#selecot`是OC的一个方法</span>
    view<span class="token punctuation">.</span><span class="token function">addGestureRecognizer</span><span class="token punctuation">(</span>revealVC<span class="token punctuation">.</span><span class="token function">panGestureRecognizer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h1 id="地图定位"><a href="#地图定位" class="headerlink" title="地图定位"></a>地图定位</h1><p>安装包和引用头文件都在文档里。</p>
<p>引入mapView，先声明一个mapView变量：<code>var mapView: MAMapView!</code><br>然后再viewDidload()里添加View：</p>
<pre class="line-numbers language-swift"><code class="language-swift">mapView <span class="token operator">=</span> <span class="token function">MAMapView</span><span class="token punctuation">(</span>frame<span class="token punctuation">:</span> view<span class="token punctuation">.</span>bounds<span class="token punctuation">)</span><span class="token comment" spellcheck="true">//占满全屏</span>
mapView<span class="token punctuation">.</span>delegate <span class="token operator">=</span> <span class="token keyword">self</span> <span class="token comment" spellcheck="true">//地图代理，以方便重写方法.     </span>
view<span class="token punctuation">.</span><span class="token function">addSubview</span><span class="token punctuation">(</span>mapView<span class="token punctuation">)</span>
view<span class="token punctuation">.</span><span class="token function">bringSubview</span><span class="token punctuation">(</span>toFront<span class="token punctuation">:</span> panelView<span class="token punctuation">)</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre>
<p>加了代理要改这里：<br><code>class ViewController: UIViewController,MAMapViewDelegate{}</code>加一个继承</p>
<p>加Key加HTTPs啥的都在文档里了。比如这些放在<code>AppDelegate.swift</code>的<code>didFininshedLaunching()</code>中：</p>
<pre class="line-numbers language-swift"><code class="language-swift"><span class="token builtin">AMapServices</span><span class="token punctuation">.</span><span class="token function">shared</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>enableHTTPS <span class="token operator">=</span> <span class="token boolean">true</span>
<span class="token builtin">AMapServices</span><span class="token punctuation">.</span><span class="token function">shared</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>apiKey <span class="token operator">=</span> <span class="token string">"YOUR KEY"</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>
<h2 id="GPX文件制作"><a href="#GPX文件制作" class="headerlink" title="GPX文件制作"></a>GPX文件制作</h2><p><a href="http://mygeoposition.com" target="_blank" rel="noopener">http://mygeoposition.com</a></p>
<p>Note：调用Google地图，需富强上网。</p>
<p>PS：经纬度数据可能不准确。在<a href="http://mygeoposition.com获取了GPX文件后可以再到http://lbs.amap.com/console/show/picker" target="_blank" rel="noopener">http://mygeoposition.com获取了GPX文件后可以再到http://lbs.amap.com/console/show/picker</a> 查到对应的经纬度修改下。</p>
<h2 id="POI"><a href="#POI" class="headerlink" title="POI"></a>POI</h2>
            </div>
            <hr>

            

            <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">

<div id="article-share">
    
    <div class="social-share" data-disabled="qzone" data-wechat-qrcode-helper="<p>微信里点“发现”->“扫一扫”二维码便可查看分享。</p>"></div>
    
</div>

<script src="/libs/share/js/social-share.min.js"></script>

            <div class="reprint">
                <p>
                    <span class="reprint-tip">转载请注明: </span>
                    <a href="https://xuanshan.gitee.io" class="b-link-green">炫杉</a>
                    <i class="fa fa-angle-right fa-lg fa-fw text-color"></i>
                    <a href="/iOS/ofo仿写记录/" class="b-link-green">ofo仿写记录</a>
                </p>
            </div>
        </div>
    </div>

    

    

    

    
    <div class="livere-card card" data-aos="fade-up">
    <!-- 来必力City版安装代码 -->
    <div id="lv-container" class="card-content" data-id="city" data-uid="MTAyMC8yOTg2My82NDI5">
        <script type="text/javascript">
            (function (d, s) {
                let j, e = d.getElementsByTagName(s)[0];
                if (typeof LivereTower === 'function') {
                    return;
                }

                j = d.createElement(s);
                j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
                j.async = true;

                e.parentNode.insertBefore(j, e);
            })(document, 'script');
        </script>
        <noscript>为正常使用来必力评论功能请激活JavaScript。</noscript>
    </div>
    <!-- City版安装代码已完成 -->
</div>
    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">上一篇</div>
            <div class="card">
                <a href="/Python/爬一个520礼物给紫玉/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/21.jpg" class="responsive-img" alt="爬一个520礼物给紫玉">
                        
                        <span class="card-title">爬一个520礼物给紫玉</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary">520送点啥呢。有Python不慌~哈哈我们来试着找一辆5月20号13点14的列车吧~

从分析到实践初探百度了下列车时刻表，有个ip138，就爬它啦🤭。先读一下第一页的内容：这网站太老了。竟然不是UTF-8编码的。解码：使用urlope</div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="fa fa-clock-o fa-fw icon-date"></i>2018-05-18
                        </span>
                        <span class="publish-author">
                            
                            <i class="fa fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/Python/" class="post-category" target="_blank">
                                    Python
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/Demo/" target="_blank">
                        <span class="chip bg-color">Demo</span>
                    </a>
                    
                    <a href="/tags/Python/" target="_blank">
                        <span class="chip bg-color">Python</span>
                    </a>
                    
                    <a href="/tags/Spider/" target="_blank">
                        <span class="chip bg-color">Spider</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">下一篇</div>
            <div class="card">
                <a href="/Blockchain/EOS初探/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/6.jpg" class="responsive-img" alt="EOS初探">
                        
                        <span class="card-title">EOS初探</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary">EOS这几天就像疯了。两周前我￥35入的（当时价格在0.0008BTC），大约两天后在59左右不到60（0.0011BTC）就出了，当时还觉得很高兴。。。五一出去和紫玉玩了一天回来，今天看120(0.0010)了。再涨买都不买不起了，今天开</div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="fa fa-clock-o fa-fw icon-date"></i>2018-05-01
                            </span>
                        <span class="publish-author">
                            
                            <i class="fa fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/Blockchain/" class="post-category" target="_blank">
                                    Blockchain
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/Blockchain/" target="_blank">
                        <span class="chip bg-color">Blockchain</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>
</div>
    </div>
    <div class="col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title">目录</div>
            <div id="toc-content">

            </div>
        </div>
    </div>
</div>

<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingSelector: 'h1,h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h1,h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });
    });
</script>
    

</main>

<footer class="page-footer bg-color">
    <div class="container row center-align">
        <div class="col s12 m8 l8 copy-right">
            &copy;<a href="https://o--o.win" target="_blank">炫杉2018</a> 
            <a href="https://hexo.io/" target="_blank">Hexo</a> 强力驱动
              主题 <a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">matery</a>        </div>
        <div class="col s12 m4 l4 social-link"><a href="https://github.com/ixsim" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
    <i class="fa fa-github"></i>
</a>

<a href="mailto:chenjiayin1990@163.com" class="tooltipped" target="_blank" data-tooltip="邮件:chinalixs@qq.com" data-position="top" data-delay="50">
    <i class="fa fa-envelope-open"></i>
</a>

<a href="http://wpa.qq.com/msgrd?v=3&uin=6956820&site=qq&menu=yes" class="tooltipped" data-tooltip="QQ: 6956820" data-position="top" data-delay="50">
    <i class="fa fa-qq"></i>
</a>
</div>
    </div>
</footer>

<div class="progress-bar"></div>


<!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title">搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字" class="search-input" autofocus>
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
    searchFunc("/" + "search.xml", 'searchInput', 'searchResult');
</script>
<!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fa fa-angle-up"></i>
    </a>
</div>


<script src="/libs/materialize/js/materialize.min.js"></script>
<script src="/libs/masonry/masonry.pkgd.min.js"></script>
<script src="/libs/aos/aos.js"></script>
<script src="/libs/scrollprogress/scrollProgress.min.js"></script>
<script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
<script src="/js/matery.js"></script>
</body>
</html>